I wonder about the proper way to Block/Release/Destroy modal dialog boxes, which freeze the interface and insist the box be dealt with next.
I see that ...
o The action buttons on the Modal Box should 'release' the box if you want it to disappear.
o DXL continues to execute after the 'release' until it ends, presumably to the end of the apply
function or a call to halt.
o Once the 'release' thread ends, code after the 'block' statement is executed.
It appears that code should be written such that ...
o 'hide' does not make much sense for 'block'ed modal dialogs, unless you want to hide
it while its working, figuring to release it without interruption.
o The box should be destroyed and set null only after the block statement, specifically not
in any of the apply functions and certainly not in any of the callbacks. Depending on timing
I believe DOORS gets confused about resuming after 'block' when the dialog is destroyed
before hand.
o Any custom 'close' function should 'release', but not 'destroy'.
llandale - Thu Jul 01 14:35:59 EDT 2010 |
Re: BlockReleaseDestroy - if I use block, I use release immediately after ... this way DOORS won't lock up - if I use block, I use destroy since the dialog ressources are not freed automatically, but not from a callback function -> do it somewhere after the block, when you don't need the dialog box anymore. - if I use show, I just use hide and hope that DOORS will do the cleanup properly for me Using hide when you use block is very useful: You can block and release a dialog box multiple times (e.g. if you do a check on the input data after the block -> block the box again if the input was not good). Additionally I think that release will NOT hide the dialog box, but I might be wrong there -> I think if you use an OK button, a CANCEL button or the default close button, then the dialog will be removed from screen after clicking those buttons. Otherwise it will stay open and you need to remove it manually. Did not try it so I might be wrong with this. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: BlockReleaseDestroy Mathias Mamsch - Thu Jul 01 16:42:55 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
This appears to be a reasonble structure for blocking a dialog which has input that must be validated before processing can continue and the dialog hidden. If input on the dialog isn't validated, the dialog is blocked again. When Prompted, you can decide if the input is validated or not.
DB db
bool InputOK = true,
DoneOnce = false
void applyDoIt(DB dbXX)
{
InputOK = confirm("[confirm] if Input is OK, [cance] to prompt dialog again")
release(db)
print InputOK "\tin DoIt\n"
}
void MakeDialog()
{
db = create("Block")
apply(db, "DoIt", applyDoIt)
realize(db, 50, 50)
InputOK = false
DoneOnce = false
while(! InputOK or !DoneOnce)
{ InputOK = true // lets native 'close' button cancel
block(db)
print "after Block\n"
if (InputOK and !DoneOnce)
{ InputOK = false
DoneOnce = true
print "setting DoneOnce\n"
}
}
print "after loop\n"
destroy(db)
}
MakeDialog()
DB db
bool InputOK = true,
Closed = false
void applyDoIt(DB dbXX)
{
InputOK = confirm("[confirm] if Input is OK, [cance] to prompt dialog again")
Closed = false // No, this is not the 'close' button
release(db)
print InputOK "\tin DoIt\n"
}
void MakeDialog()
{
db = create("Block")
apply(db, "DoIt", applyDoIt)
realize(db, 50, 50)
InputOK = false
Closed = false
while(! InputOK and ! Closed)
{ Closed = true // lets native 'close' button cancel
block(db)
print "after Block\n"
}
print "after loop\n"
destroy(db)
}
MakeDialog()
|
Re: BlockReleaseDestroy llandale - Fri Jul 02 15:04:48 EDT 2010
This appears to be a reasonble structure for blocking a dialog which has input that must be validated before processing can continue and the dialog hidden. If input on the dialog isn't validated, the dialog is blocked again. When Prompted, you can decide if the input is validated or not.
DB db
bool InputOK = true,
DoneOnce = false
void applyDoIt(DB dbXX)
{
InputOK = confirm("[confirm] if Input is OK, [cance] to prompt dialog again")
release(db)
print InputOK "\tin DoIt\n"
}
void MakeDialog()
{
db = create("Block")
apply(db, "DoIt", applyDoIt)
realize(db, 50, 50)
InputOK = false
DoneOnce = false
while(! InputOK or !DoneOnce)
{ InputOK = true // lets native 'close' button cancel
block(db)
print "after Block\n"
if (InputOK and !DoneOnce)
{ InputOK = false
DoneOnce = true
print "setting DoneOnce\n"
}
}
print "after loop\n"
destroy(db)
}
MakeDialog()
DB db
bool InputOK = true,
Closed = false
void applyDoIt(DB dbXX)
{
InputOK = confirm("[confirm] if Input is OK, [cance] to prompt dialog again")
Closed = false // No, this is not the 'close' button
release(db)
print InputOK "\tin DoIt\n"
}
void MakeDialog()
{
db = create("Block")
apply(db, "DoIt", applyDoIt)
realize(db, 50, 50)
InputOK = false
Closed = false
while(! InputOK and ! Closed)
{ Closed = true // lets native 'close' button cancel
block(db)
print "after Block\n"
}
print "after loop\n"
destroy(db)
}
MakeDialog()
I don't like the idea of doing the input check in the apply function. This forces me to declare the DBE variables globally.
void makeMyDialog () {
DB diag = create "temporary dialog"
DBE ed = text (...)
DBE rb = choice (...)
string s
int nr
while (1) {
block diag
release diag
s = get ed
nr = get rb
if (variables are ok) {
destroy diag
break
}
ack "Please do it again!"
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: BlockReleaseDestroy Mathias Mamsch - Sat Jul 03 04:51:38 EDT 2010
I don't like the idea of doing the input check in the apply function. This forces me to declare the DBE variables globally.
void makeMyDialog () {
DB diag = create "temporary dialog"
DBE ed = text (...)
DBE rb = choice (...)
string s
int nr
while (1) {
block diag
release diag
s = get ed
nr = get rb
if (variables are ok) {
destroy diag
break
}
ack "Please do it again!"
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
The 'close' apply function takes the DB as a parameter. You can 'hide' it but setting it to null will not change the actual variable. |